import request from '@/utils/request'

export default {
    //测算模型列表
    getCalculateList(searchModel) {
        return request({
            url: '/calculate',
            method: 'get',
            params: {
                page: searchModel.pageNo,
                paginate: searchModel.pageSize,
                pageSize: searchModel.pageSize,

                // username: searchModel.username,
                // state: searchModel.state,
                // role: searchModel.role,
            }
        });
    },

    //新增/修改测算模型
    saveCalculate(form) {
        if (form.id) {

        } else {
            return request({
                url: '/calculate',
                method: 'post',
                data: form
            });
        }

    },

    //成本汇总表
    getCalculateCostCollect(id) {
        return request({
            url: '/calculate_cost_summary/cost_summary/' + id,
            method: 'get',
            params: {
            }
        });
    },

    //收入面积汇总表
    getCalculateBuildingList(id) {
        return request({
            url: '/calculate_building/' + id,
            method: 'get',
            params: {
            }
        });
    },

    //测算收入表
    getCalculateIncome(id) {
        return request({
            url: '/calculate_income/' + id,
            method: 'get',
            params: {
            }
        });
    },

    getCalculateInfo(id) {
        return request({
            url: '/calculateInfo/' + id,
            method: 'get',
            params: {
            }
        });
    },

    getCalculateTaxById(id) {
        return request({
            url: '/calculate_income_tax/' + id,
            method: 'get',
            params: {
            }
        });
    },

    setCalculate(form) {
        return request({
            url: 'calculate_set',
            method: 'post',
            params: {
                id: form.id,
                ybjstucb: form.ybjstucb,

            },
        });
    },

    //添加/修改税率
    saveCalculateTax(form) {
        return request({
            url: 'calculate_income_tax',
            method: 'post',
            params: {

                calculate_id: form.calculate_id,

                id: form.id,

                ratio: form.ratio,

                residence: form.residence,

                nresidence: form.nresidence,

                up_storeroom: form.up_storeroom,

                up_business: form.up_business,

                up_carport: form.up_carport,
            },
        });
    },

    saveCalculateTaxMoney(form) {
        return request({
            url: 'calculate_income_tax_money',
            method: 'post',
            params: {

                calculate_id: form.calculate_id,

                id: form.id,

                residence_money: form.residence_money,

                nresidence_money: form.nresidence_money,

                up_storeroom_money: form.up_storeroom_money,

                up_business_money: form.up_business_money,

                up_carport_money: form.up_carport_money,

                down_storeroom_money: form.down_storeroom_money,

                down_business_money: form.down_business_money,

                down_carport_money: form.down_carport_money,
            },
        });
    },

    //单体一
    getCalculateBuildingNumberList(id) {
        return request({
            url: '/calculate_building_number/' + id,
            method: 'get',
            params: {
            }
        });
    },

    //单体4
    getCalculateExclusiveBuilding(id){
        return request({
            url: '/calculate_exclusive_building/' + id,
            method: 'get',
            params: {
            }
        });
    },

    //添加/修改专属明细
    saveCalculateExclusive(form) {
        return request({
            url: 'calculate_save_exclusive',
            method: 'post',
            params: {

                calculate_id: form.calculate_id,

                id: form.id,

                title: form.title,

                _1: form['_1'],
                _2: form['_2'],
                _3: form['_3'],
                _4: form['_4'],
                _5: form['_5'],
                _6: form['_6'],
                _7: form['_7'],
                _8: form['_8'],

                checkedCities: form.checkedCities,

                checkedCities1: form.checkedCities1,

                checkedCities2: form.checkedCities2,
            },
        });
    },

    //根据id获取专属详情
    getCalculateExclusive(id){
        return request({
            url: '/calculate_exclusive/' + id,
            method: 'get',
            params: {
            }
        });
    },

    //专属列表
    getCalculateExclusiveList(id){
        return request({
            url: '/calculate_exclusive_list/' + id,
            method: 'get',
            params: {
            }
        });
    },


    // getUserById(id) {
    //     return request({
    //         url: '/users/' + id,
    //         method: 'get',
    //         params: {
    //         }
    //     });
    // },
    // updateUserInfo(user) {
    //     return request({
    //         url: '/users/' + user.id,
    //         method: 'post',
    //         data: user,
    //     });
    // },
    // saveUser(user) {

    //     if (user.id == null || user.id == undefined) {
    //         console.log(user.id);
    //         return this.addUser(user);
    //     }
    //     return this.updateUserInfo(user);
    // },

}